/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tudienthuoc;
import java.sql.*;
import java.util.ArrayList;
/**
 *
 * @author MRQUANGSON
 */

public class Func {
    String UserName;
    String Password;
    String url;
      public  Func(String UserName,String Password,String url )
            
    {
        this.Password=Password;
        this.UserName=UserName;
        
        
            this.url="jdbc:mysql://localhost:3307/tudiencaythuoc";
       
        
    }
    
    public void HoThuoc_Insert(int IDLoaiThuoc,String TenChungAV,String TenTV,String TenTA,String LinkTA,String Chi,String AnhDaiDien,String MieuTa,String GhiChu)
    {
         Connection conn=null;
        try
        {
            String sqlString="INSERT INTO HoThuoc(IDLoaiThuoc,TenChungAV,TenTV,TenTA,LinkTA,Chi,AnhDaiDien,MieuTa,GhiChu)"
                    +" VALUES(?,?,?,?,?,?,?,?,?);";
            conn=DriverManager.getConnection(url, UserName, Password);
            PreparedStatement preS=conn.prepareStatement(sqlString);
            //IDLoaiThuoc,TenChungAV,TenTV,TenTA,LinkTA,Chi,AnhDaiDien,MieuTa,GhiChu,NgayTao,NgayCapNhat
            preS.setString(1,String.valueOf(IDLoaiThuoc));
            preS.setString(2,String.valueOf(TenChungAV));
            preS.setString(3,String.valueOf(TenTV));
            preS.setString(4,String.valueOf(TenTA));
            preS.setString(5,String.valueOf(LinkTA));
            preS.setString(6,String.valueOf(Chi));
            preS.setString(7,String.valueOf(AnhDaiDien));
            preS.setString(8,String.valueOf(MieuTa));
            preS.setString(9,String.valueOf(GhiChu));
       //     preS.setDate(10,NgayTao);
        //     preS.setDate(11,NgayCapNhat);
            preS.executeUpdate();
            conn.close();
        }
        catch(Exception ex)
        {
            System.err.print(ex);
        }
    }
}
